UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'KehswPOAPyp4RUarn4nElYZZiU0s1w4Oj5XpddrONvg='
WHERE
key_id = '8b09fb2aad6b4df0362f37661149e9830f18498cb3c05d398e26d0324e4549f0'
AND (
token = 'KehswPOAPyp4RUarn4nElYZZiU0s1w4Oj5XpddrONvg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)