UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'V6qIg3C1/Yd6IR2STpzg+oN3Gjj9JT6Cwgn70fZ50Rw='
WHERE
key_id = 'a279c0ae635ef0e3205170ed16c0469c656ec822822b2735df160fefd1c86c5f'
AND (
token = 'V6qIg3C1/Yd6IR2STpzg+oN3Gjj9JT6Cwgn70fZ50Rw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)