UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '4Nhymc64BTeZoHBP4o+fhv2EQyqs+vYqlh9iePH5zlI='
WHERE
key_id = 'd845a6fd36f429ddb03e41cfddc6b8043a175a9ef50fbe16b31689fb49a5cb0c'
AND (
token = '4Nhymc64BTeZoHBP4o+fhv2EQyqs+vYqlh9iePH5zlI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)