UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'irCjcGT0d1CLxajO4Ib7cFem4WmznNq6qC4yWMc8XcI='
WHERE
key_id = 'c64d2e1eaf6a8dfba647d89b5ca8a75bd1f0641841187e8a7244e5ca6f031a79'
AND (
token = 'irCjcGT0d1CLxajO4Ib7cFem4WmznNq6qC4yWMc8XcI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)