UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'tNnLuufthyhNY6GJFSqSMHIDlwEmJk4qeGrndQDu8cE=' 
WHERE 
  key_id = '2a0535ffddfd79fef87becb7ea6b6cf056e5cc4e311b6e34d6a041f6225dd549' 
  AND (
    token = 'tNnLuufthyhNY6GJFSqSMHIDlwEmJk4qeGrndQDu8cE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00016