UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'QWb8IQSgJ4QET8GIX+myaG3oZ9MthYlU2tbWuh+Te+o=' 
WHERE 
  key_id = '69068f20044c9c5bec1c08b0c17024a655740c1e2779c3b6e971e744924d3a8a' 
  AND (
    token = 'QWb8IQSgJ4QET8GIX+myaG3oZ9MthYlU2tbWuh+Te+o=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036