UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'QB2qEcZ0j/+P5VyBPW34EBY33OVgpcYdutFyR7aoW9E='
WHERE
key_id = 'cd3b5c0e9d91e72a1d63aaa6fe1082112136fe808cee3c16201e047f59a4805a'
AND (
token = 'QB2qEcZ0j/+P5VyBPW34EBY33OVgpcYdutFyR7aoW9E='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)