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