UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'bfW9Y7fhCNBgNaoxcRDOm+gpK6UXnGZTORpw2+a4WpA='
WHERE
key_id = 'af7e49f41b32d4076a0f9cfd6b3ea055be3126fa8367f5dd21e8a37e13043dc8'
AND (
token = 'bfW9Y7fhCNBgNaoxcRDOm+gpK6UXnGZTORpw2+a4WpA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)