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