UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'fPbGA4YOo2WqFkSs47T0O4i0PDld3bEwMdvrC8vYcTo='
WHERE
key_id = '5c3ff2fea0c9b1b36b9a2c4b5d80f412e9504f7d6f271b96c8df5cb4cc293a9c'
AND (
token = 'fPbGA4YOo2WqFkSs47T0O4i0PDld3bEwMdvrC8vYcTo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)