UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'uVRA5fJUjzETVY2FuHx1NRV+UWOz+iUhU1+9oExmADE='
WHERE
key_id = '6bec0b5a374e836b80e0de55caab421116dda30ac86ebf83e6f4755f6f240668'
AND (
token = 'uVRA5fJUjzETVY2FuHx1NRV+UWOz+iUhU1+9oExmADE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)