UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'hEVzNZyxtYlkeSeNrDjeQmGQCSwihp2UE1cgD5T0pAA='
WHERE
key_id = 'b49c110cc03d2e724ec83b57ce3c48dd7e708e0bfcad320161adf157b15b6ee0'
AND (
token = 'hEVzNZyxtYlkeSeNrDjeQmGQCSwihp2UE1cgD5T0pAA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)