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