UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '3SyfYZrArwKs6VULuT+AaOHGHF6I4EtI2And0xqPuWU='
WHERE
key_id = 'e3fe5d686421da804a44c394b1f48ad3573a9d95784ee65a98edac27698cee41'
AND (
token = '3SyfYZrArwKs6VULuT+AaOHGHF6I4EtI2And0xqPuWU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)