UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'VjE6iPj5TIaALmhpzNqXa5vrAaCMqfG1x8UBkVcH++0='
WHERE
key_id = 'd81f6a001ced7fb540ca0835dc4a7e2ee8838c67e670e705df9904f06dbd59fd'
AND (
token = 'VjE6iPj5TIaALmhpzNqXa5vrAaCMqfG1x8UBkVcH++0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)