UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'dcAGl4wzvalh31SroMaSRgXhmQpSO0lYNJ+lLeSdYfE=' 
WHERE 
  key_id = '994d33cdcfb2a52533608dd9f1e486cc5312b6cdb40f007186b88f99b4cf94b7' 
  AND (
    token = 'dcAGl4wzvalh31SroMaSRgXhmQpSO0lYNJ+lLeSdYfE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032