UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'tSZUuZc7gIlQF4/LczWKVRFeaucuSfxCyW8MH94jX2E='
WHERE
key_id = 'f31f9d17b18f548c16a75567a04a8d22a3f0e7ee083a7e9387f19a6a12a58685'
AND (
token = 'tSZUuZc7gIlQF4/LczWKVRFeaucuSfxCyW8MH94jX2E='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)