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