UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '7ian1taSt0c51CUKPCpFVepdMw6jbNrNQIRp1Aigdcs='
WHERE
key_id = '5e1c2f6549b2aebe0365fbfb733d7034adf3e75d54825e95d29e2e227f5aeed8'
AND (
token = '7ian1taSt0c51CUKPCpFVepdMw6jbNrNQIRp1Aigdcs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)