UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'KJWNn3eQkfOP2xLYCN5flQajtzCSoRyZ+7LnCfTSfdw='
WHERE
key_id = 'a1658172be4e9590c1f1d4af2bcc92073c60d5ba65988c3a506afe23ff9e2e91'
AND (
token = 'KJWNn3eQkfOP2xLYCN5flQajtzCSoRyZ+7LnCfTSfdw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)