UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'CB7ZNwqupqrLDVEoDD+EfgoHYMlKQlZxWylkSiLDJV0=' 
WHERE 
  key_id = '7f37c5a5d84b0e411226bed90837e20fc446c9c672372d3aa9cec7e39a5a7812' 
  AND (
    token = 'CB7ZNwqupqrLDVEoDD+EfgoHYMlKQlZxWylkSiLDJV0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037