UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'I+dc+S4vfaITMP0eARrNmcjIWDz1ImITul+Qv0jYhVE='
WHERE
key_id = 'f56bda9034424de3460cac84ea94ad92b0d6bdf11e84e41ecd107efbcfc11243'
AND (
token = 'I+dc+S4vfaITMP0eARrNmcjIWDz1ImITul+Qv0jYhVE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)