UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'eGvxAk1ORrd4GzAejDEW+E2U0wu3ZMXvKxsmkE0OLOE='
WHERE
key_id = '40b7ce5619b0ee3558bc0cd21679be2d5c3269e783725c9a0ed7e410d8e8fc53'
AND (
token = 'eGvxAk1ORrd4GzAejDEW+E2U0wu3ZMXvKxsmkE0OLOE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)