UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'K6RltHFC7bahouf9G3wLG0pWCrIYxvT25xtKVenLEFI=' 
WHERE 
  key_id = '2381063982a9442911bc4855ed6fbdca6f6038c44a3fe3445c2a1d684284ee59' 
  AND (
    token = 'K6RltHFC7bahouf9G3wLG0pWCrIYxvT25xtKVenLEFI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025