UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'X9U+vpLPGP2jsldhxKR7NeLDK9AfBf3WtjpO2Rio+mE='
WHERE
key_id = 'c160ef91811f94bb3874bba440112fcd4ec2c8c48b896a693af3cb2ee4419d21'
AND (
token = 'X9U+vpLPGP2jsldhxKR7NeLDK9AfBf3WtjpO2Rio+mE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)