UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'tBaCZEmI99AsddqnbZ0BSvnkiPCl5apuumu8AxY1quo='
WHERE
key_id = '8eb936ed4bf500916aff5edac87bbde3d6c68555022ee653db868b7ba43a429a'
AND (
token = 'tBaCZEmI99AsddqnbZ0BSvnkiPCl5apuumu8AxY1quo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)