UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'GnHyuZi4MZTflCKxkdcno4n2Ex41jwaJLvzKYaEkaHw='
WHERE
key_id = '76465e6efff4aae90be9ee352c3baf38f8146a4e79f9e4b9997aee65c0b536cb'
AND (
token = 'GnHyuZi4MZTflCKxkdcno4n2Ex41jwaJLvzKYaEkaHw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)