UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '8IejnH74J1RxlsQ+GX8nsfQ5FcGuJTa4UIObkcX7+ws='
WHERE
key_id = 'b3eed5cde783d544f8bcf1de3d7b2d98ecafda06080ac42e0e3ca51e0102ee6d'
AND (
token = '8IejnH74J1RxlsQ+GX8nsfQ5FcGuJTa4UIObkcX7+ws='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)