UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'WCwF/arl5FiFgC245sVVefIXqZeEfk7qgwI2X505vPk='
WHERE
key_id = 'fdad2b7c2542268e30d5aefbdd429fdde219eaaa519bdd617dc4a441ebf5d7fe'
AND (
token = 'WCwF/arl5FiFgC245sVVefIXqZeEfk7qgwI2X505vPk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)