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