UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'bYX+7abB5/fk2YZl5isxSvWEJWND59MSJ+pjg0pOoZA='
WHERE
key_id = '7ffb57744713d5ca0baf1155bd8d3f325787e855c9ba8141aca37565ab07cba9'
AND (
token = 'bYX+7abB5/fk2YZl5isxSvWEJWND59MSJ+pjg0pOoZA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)