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