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