UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'XEP9VPtBRxCQS1X60D8C2ekTSXlP7FNo4+dS1ybnWCk='
WHERE
key_id = '0d967a5de425627c96db82680ca2aa6c4b273676ef454088b3a336ebddee1282'
AND (
token = 'XEP9VPtBRxCQS1X60D8C2ekTSXlP7FNo4+dS1ybnWCk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)